<template>
  <div id="userLayout" :class="['user-layout-wrapper', device]">
    <div
      class="container"
      :style="{
        backgroundImage: sysConfig.backgroundUrl ? 'url(' + sysConfig.backgroundUrl + ')' : '',
        backgroundSize: '100% 100%',
      }"
    >
      <div v-if="sysConfig && sysConfig.sysName" class="top">
        <div class="header">
          <a href="/">
            <img :src="sysConfig.logoUrl ? sysConfig.logoUrl.imagePathSmall : logo" class="logo" alt="logo" />
            <span class="title">{{ sysConfig.sysName }}</span>
          </a>
        </div>
        <div class="desc"></div>
      </div>
      <div v-else class="_pt-50"></div>

      <route-view></route-view>

      <div style="position: absolute; width: 100%; bottom: 0">
        <GlobalFooter />
      </div>
    </div>
  </div>
</template>

<script>
import RouteView from './RouteView'
import { mixinDevice } from '@/utils/mixin'
import { mapGetters } from 'vuex'
import logo from '@/assets/logo.png'
import GlobalFooter from '@/components/GlobalFooter/GlobalFooter'

export default {
  name: 'UserLayout',
  components: { RouteView, GlobalFooter },
  mixins: [mixinDevice],
  data() {
    return {
      logo: logo,
      url: '',
    }
  },
  mounted() {
    document.body.classList.add('userLayout')
  },
  beforeDestroy() {
    document.body.classList.remove('userLayout')
  },
  computed: {
    ...mapGetters(['sysConfig']),
  },
}
</script>

<style lang="less" scoped>
.recordNumberLink {
  color: rgba(0, 0, 0, 0.45);
}

.recordNumberLink:hover {
  text-decoration: underline !important;
  color: #1891ff;
}

#userLayout.user-layout-wrapper {
  height: 100%;

  &.mobile {
    .container {
      .main {
        max-width: 368px;
        width: 98%;
      }
    }
  }

  @media screen and (max-height: 2000px) {
    .container {
      padding: 110px 0 144px;
    }
  }

  @media screen and (max-height: 870px) {
    .container {
      padding: 90px 0 124px;
    }
  }

  @media screen and (max-height: 830px) {
    .container {
      padding: 70px 0 104px;
    }
  }

  @media screen and (max-height: 790px) {
    .container {
      padding: 60px 0 94px;
    }
  }

  @media screen and (max-height: 770px) {
    .container {
      padding: 50px 0 64px;
    }
  }

  @media screen and (max-height: 723px) {
    .container {
      padding: 17px 0 20px;
    }
  }

  @media screen and (max-height: 630px) {
    .container {
      padding: 50px 0 74px;
    }
  }

  .container {
    width: 100%;
    max-width: unset;
    min-height: 100%;
    background: #f0f2f5 url(~@/assets/background.svg) no-repeat 50%;
    background-size: 100%;
    position: relative;

    a {
      text-decoration: none;
    }

    .top {
      text-align: center;

      .header {
        height: 44px;
        line-height: 44px;

        .badge {
          position: absolute;
          display: inline-block;
          line-height: 1;
          vertical-align: middle;
          margin-left: -12px;
          margin-top: -10px;
          opacity: 0.8;
        }

        .logo {
          height: 44px;
          vertical-align: top;
          margin-right: 16px;
          border-style: none;
        }

        .title {
          font-size: 28px;
          color: rgba(0, 0, 0, 0.85);
          font-family: Avenir, 'Helvetica Neue', Arial, Helvetica, sans-serif;
          font-weight: 600;
          position: relative;
          top: 2px;
          letter-spacing: 15px;
        }
      }

      .desc {
        font-size: 14px;
        color: rgba(0, 0, 0, 0.45);
        margin-top: 12px;
        margin-bottom: 40px;
      }
    }

    .main {
      min-width: 260px;
      width: 500px;
      margin: 0 auto;
    }
  }
}
</style>
